package com.youshang520i.nacosserviceconsume.service.fallback;

import com.youshang520i.nacosserviceconsume.service.ConsumeService;
import com.youshang520i.nacosserviceconsume.service.impl.ConsumeServiceImpl;
import feign.hystrix.FallbackFactory;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

/**
 * @author youshang
 */
@NoArgsConstructor
@Data
@Log4j2
@Component
public class ConsumeServiceFallbackFactory implements FallbackFactory<ConsumeServiceImpl> {

//    private Throwable throwable;
//
//    public ConsumeServiceFallbackFactory(Throwable throwable){
//        this.throwable = throwable;
//    }

    @Override
    public ConsumeServiceImpl create(Throwable throwable) {
        log.info("警告。。。。");
        return new ConsumeServiceImpl(throwable);
    }
}
